home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / web / reduce / rweb / underscore.web < prev   
Encoding:
Text File  |  1992-01-01  |  811 b   |  33 lines

  1. % Copyright (c) 1991: Marcel Roelofs and Peter Gragert
  2. %                     University of Twente, Enschede, The Netherlands
  3. % @@(#) underscore.web (91/03/11)
  4.  
  5. @* Filter to remove underscores from REDUCE source. REDUCE does not
  6. allow sole underscores in identifiers. However, underscores preceded
  7. by an exclamation mark are allowed. Also REDUCE strings may contain
  8. underscores. The following C program is a filter that removes the
  9. forbidden underscores.
  10.  
  11. @u
  12. #include <stdio.h>
  13.  
  14. main (ac, av)
  15. char **av;
  16. {
  17. char c;
  18. while ((c=getc(stdin)) != EOF) 
  19.    if (c=='!') { 
  20.       putc(c,stdout); 
  21.       c=getc(stdin);
  22.       putc(c,stdout);
  23.    }
  24.    else 
  25.       if (c=='\"') { 
  26.          while (putc(c,stdout), (c=getc(stdin)) != '\"') ;
  27.          putc(c,stdout);
  28.       }
  29.       else 
  30.          if (c != '_') putc(c,stdout);
  31. }
  32.  
  33.